package roborally;
/**
 * @version	3.0
 * @author 	Lies Tambeur 	r0264469	2Bcwsbbh
 * @author	Eline Vanrykel	r0264543	2Bcwselt 
 */
public enum Orientation {

	UP{
		/**
		 * @return | result == RIGHT
		 */
		@Override
		public Orientation turnClockwise() {
			return RIGHT;
		}
		/**
		 * @return | result == LEFT
		 */
		@Override
		public Orientation turnCounerClockwise() {
			return LEFT;
		}
		
		/**
		 * @return	| result == 0
		 */
		@Override
		public int toInt() {
			return 0;
		}
		
	},
	
	RIGHT{
		/**
		 * @return | result == DOWN
		 */
		@Override
		public Orientation turnClockwise() {
			return DOWN;
		}
		/**
		 * @return | result == UP
		 */
		@Override
		public Orientation turnCounerClockwise() {
			return UP;
		}
		
		/**
		 * @return	| result == 1
		 */
		@Override
		public int toInt() {
			return 1;
		}
		
	},
	
	DOWN{
		/**
		 * @return | result == LEFT
		 */
		@Override
		public Orientation turnClockwise() {
			return LEFT;
		}
		/**
		 * @return | result == RIGHT
		 */
		@Override
		public Orientation turnCounerClockwise() {
			return RIGHT;
		}
		
		/**
		 * @return	| result == 2
		 */
		@Override
		public int toInt() {
			return 2;
		}
		
	},
	
	LEFT{
		/**
		 * @return | result == UP
		 */
		@Override
		public Orientation turnClockwise() {
			return UP;
		}
		/**
		 * @return | result == DOWN
		 */
		@Override
		public Orientation turnCounerClockwise() {
			return DOWN;
		}
		
		/**
		 * @return	| result == 3
		 */
		@Override
		public int toInt() {
			return 3;
		}
		
	};
	

	public abstract Orientation turnClockwise();

	public abstract Orientation turnCounerClockwise();
	
	public Orientation turn(Direction direction){
		if(direction == Direction.CLOCKWISE){
			return this.turnClockwise();
		}
		else if(direction == Direction.COUNTERCLOCKWISE){
			return this.turnCounerClockwise();
		}
		assert(false);
		return null;
	}
	
	public abstract int toInt();
}
